package com.ftg.learn.util;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 布衣
 */
@Component
@Slf4j
@ConfigurationProperties(prefix = "myredis")
public class MyRedisProperties {

    private Node master;
    private List<Node> follower;

    public Node getMaster() {
        log.info("master:{}", master);
        return master;
    }

    public void setMaster(Node master) {
        this.master = master;
    }

    public List<Node> getFollower() {
        return follower;
    }

    public void setFollower(List<Node> follower) {
        this.follower = follower;
    }

    public static class Node {
        private String host;
        private int port;
        private boolean healthy;

        public boolean isHealthy() {
            return healthy;
        }

        public void setHealthy(boolean healthy) {
            this.healthy = healthy;
        }

        public String getHost() {
            return host;
        }

        public void setHost(String host) {
            this.host = host;
        }

        public int getPort() {
            return port;
        }

        public void setPort(int port) {
            this.port = port;
        }
    }
}

